#!/bin/bash

appName="blog-0.0.1-SNAPSHOT.jar"
# 检查是否已存在进程，避免重复启动
if pgrep -f "java -jar ${appName}" > /dev/null
then
    echo "Application is already running."
else
    cd /root/app/target
    pwd
    echo "Starting the application..."
    nohup java -jar ${appName}  >> app.log 2>&1 &

    PID=$(pgrep -f "java -jar ${appName}")

    echo "Application started. Check 'app.log' for details.PID is "$PID
fi